package demo1;

public class MathDemo {
    public static void main(String[] args) {
        //绝对值
        int abs = Math.abs(-10);
        System.out.println(abs);

        //向上取整
        double d1 =Math.ceil(11.1);
        System.out.println(d1);

        //向下去整
        double d2 =Math.floor(11.1);
        System.out.println(d2);

        //四舍五入
        long round = Math.round(12.5);
        System.out.println(round);

        //max
        int a =Math.max(10,20);
        System.out.println(a);

        //min
        double d3 =Math.min(2.3,12.2);
        System.out.println(d3);

        //a的b次幂
        double pow = Math.pow(2, 3);
        System.out.println(pow);

        //随机数
        double random = Math.random();
        System.out.println(random*10);

    }
}
